<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<!-- setinterval函数的用法与setTimeout完全一致，区别仅仅在于setinterval指定某个任务每隔一段时间就执行一次，也就是无限次的定时执行
    var timer = setInterval(function(){
    console.log(2);
    },1000) -->


    <script>
        var i = 0;
        setInterval(function(){
            i++;
            console.log(i);
            
        },3000)
    </script>
</body>
</html>